<!Doctype html>
<html xmlns=http://www.w3.org/1999/xhtml>
<head>
<meta http-equiv=Content-Type content="text/html;charset=utf-8">
<title>演示文档</title>
</head>

<?php 

/* *
 * 功能：/order/check
 * 版本：1.0
 * 日期：2015/5/15
 * 说明：
 * 以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写，并非一定要使用该代码。
 * 该代码仅供学习和研究提供一个参考。
 */


//引入模型文件
include_once("lib/yhd.php");

//创建对象
$orderCheck = new orderCheck();

//联系人信息
$orderCheck->receiver_id = "10000";
$orderCheck->receiver_name = "张三";
$orderCheck->receiver_province = "上海";
$orderCheck->receiver_city = "上海市";
$orderCheck->receiver_county = "浦东新区";
$orderCheck->receiver_address = "张江高科祖冲之路295号";
$orderCheck->receiver_mobile = "18087895621";
$orderCheck->receiver_phone = "010-51680666";

//商品信息 每个商品信息作为一个数组，多个商品设置循环 执行第39行 - 第50行代码即可

/*--------------------------------------多个商品循环执行 start-----------------------------------*/
$goods = array(
		"itemId"=>"item11",
		"skuId"=>"",
		"outerCode"=>"",
		"yhdProductId"=>"1799723",
		"yhdProductCode"=>"0017997238",
		"num"=>"2",
		"price"=>"18.8",
		"totalFee"=>"37.6",
		"discountFee"=>0
		);
$orderCheck->tradeItemList[] = $goods;
/*--------------------------------------多个商品循环执行 end-----------------------------------*/

//执行查询
$ret = $orderCheck->execute();


//该代码可查看接口全部返回结果
print_r($ret);



//返回结果数据使用示例
echo $ret->returnCode;
echo "<br>";
echo $ret->trackId;
echo "<br>";
$splitTicket = $ret->responseBizData->splitTicket;//需回传订单生成接口
$splitTime   = $ret->responseBizData->splitTime;//需回传订单生成接口
$splitSign   = $ret->responseBizData->splitSign;//需回传订单生成接口
$postFee   = $ret->responseBizData->postFee;//需回传订单生成接口
$fourthAreaId   = $ret->responseBizData->fourthAreaId;//需回传订单生成接口

$orderPackageList = $ret->responseBizData->orderPackageList;

foreach($orderPackageList as $orderPackage)
{
	echo $orderPackage->packageId;
	echo "<br>";
	echo $orderPackage->packagePostFee;
	echo "<br>";
	foreach($orderPackage->tradeItemList as $tradeItem)
	{
		echo $tradeItem->totalFee;
	}
}





?>